{extend name="base/index"/}

{block name="page_location"}
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
                    <li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>友情链接管理</li>
                </ol>
            </div>
            <h4 class="page-title">
                所有友情链接
                <a href="javascript:;" data-toggle="modal" data-target="#new_box" id="add_weblink_dig"
                    class="btn btn-success btn-sm ml-3">创建新的链接</a>
            </h4>
        </div>
    </div>
</div>
{/block}

{block name="body"}
<div class="row" id="weblink_page">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>链接分类</th>
                            <th>标题</th>
                            <th>链接图片</th>
                            <th>创建时间</th>
                            <th>是否显示</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {volist name='list' id="data"}
                        <tr>
                            <td>{$data.id}</td>
                            <td>{$data.classname}</td>
                            <td>{$data.webname}</td>
                            <td><img class="list_facepic preview_img"
                                    src="{$data.picurl|default='/static/admin/images/nopic.png'}" /></td>
                            <td><span class="badge badge-primary">{$data.posttime|date="Y-m-d H:i",###}</span></td>
                            <td>
                                {eq name="data.status" value="0"}
                                <a href="javascript:;" attr-id="{$data.id}" attr-model="weblink" attr-field="status"
                                    attr-val="1" class="badge badge-primary Fast_Action">显示</a>
                                {else /}
                                <a href="javascript:;" attr-id="{$data.id}" attr-model="weblink" attr-field="status"
                                    attr-val="0" class="badge badge-secondary Fast_Action">不显示</a>
                                {/eq}
                            </td>
                            <td>
                                <a href="javascript:;" class="btn btn-primary btn-sm edit_btn" attr-id="{$data.id}"
                                    data-toggle="modal" data-target="#new_box"><i
                                        class="iconfont icon-icon_compile"></i> 修改</a>
                                <a href="javascript:;" class="btn btn-danger btn-sm Fast_Del" attr-id="{$data.id}"
                                    attr-model="weblink"><i class="iconfont icon-icon_delete_fill"></i> 删除</a>
                            </td>
                        </tr>
                        {/volist}
                    </tbody>
                </table>
                <div class="row">
                    <div class="col-12" style="text-align: center;">
                        {$pagelist}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="modal_dig"}
<!-- END CONTAINER -->
<!-- Modal -->
<div class="modal fade" id="new_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-full-700">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title dig_title" id="myModalLabel">创建新的链接</h4>
                <button type="button" class="close" data-dismiss="modal">x</button>
            </div>
            <div class="modal-body">
                <form action="#" class="form-horizontal" id="edit_weblink_frm">
                    <input type="hidden" name="id" value="" />
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">选择所属分类：</label>
                        <div class="col-5">
                            <select class="form-control" tabindex="1" name="classid">
                                <option value="0">默认分类</option>
                                {volist name="classlist" id="data"}
                                <option value="{$data.id}">[{$data.id}]{$data.classname}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">链接标题：</label>
                        <div class="col-5">
                            <input type="text" name="webname" placeholder="请输入连接标题" class="form-control ipt_check"
                                data-type="string" data-len="1-100" nullmsg="连接标题不能为空" errormsg="连接标题由1-100个字符组成！"
                                value="">
                        </div>
                        <div class="col-2">
                            <span class="font-13 text-muted">必填</span>
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">链接地址：</label>
                        <div class="col-5">
                            <input type="text" name="linkurl" placeholder="请输入链接地址" class="form-control">
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">链接图片上传：</label>
                        <div class="col-5 picurl_box">
                            <div class="picurl" data-type="upload" attr-inputname="picurl" nullmsg="链接图片没有上传"
                                attr-value=""  isCompress="1"></div>
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">幻灯片描述：</label>
                        <div class="col-5">
                            <textarea class="form-control" name="description" rows="3"></textarea>
                        </div>
                    </div>
                    <div class="form-group row mb-1">
                        <label class="col-3 col-form-label">是否显示：</label>
                        <div class="col-5">
                            <div class="custom-control custom-radio">
                                <input type="radio" name="status" id="status1" class="custom-control-input" value="0"
                                    checked="checked">
                                <label class="custom-control-label" for="status1">显示</label>
                            </div>
                            <div class="custom-control custom-radio">
                                <input type="radio" name="status" id="status2" class="custom-control-input" value="1">
                                <label class="custom-control-label" for="status2">不显示</label>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_weblink_frm"
                    attr-callback="reload" attr-model="weblink" attr-active="save_weblink">保存</button>
            </div>
        </div>
    </div>
</div>
{/block}